<?
require_once("cms/core/helper/bean/Abstract.php");
require_once("cms/staff/om/StaffRolePeer.php");
require_once("cms/staff/om/StaffPeer.php");

class PHP_CMS_View_Helper_Staffs extends AbstractList {

    public function staffs($form=null) {

        if($this->isInit)
            return $this;

        parent::init($form);

        $this->criteria->addJoin(StaffPeer::USERNAME,
            StaffRolePeer::USERNAME, Criteria::LEFT_JOIN);

        $this->criteria->addJoin(StaffPeer::LANGUAGE_CODE,
            LanguagePeer::CODE, Criteria::LEFT_JOIN);

        $this->criteria->setDistinct();
        
        return $this;

    }


    /**
     * Define the propel peer we are going to use to list
     * page items.
     */
    public function getMethod() {
        return "doSelectJoinLanguage";
    }


    /**
     * Define the propel peer we are going to use to list
     * page items.
     */
    public static function getPeer() {
        return new StaffPeer();
    }


    /**
     * Return the searchable fields for this list page.
     */
    public static function getFields() {
        return array(
            StaffPeer::FIRSTNAME,
            StaffPeer::SURNAME,
            StaffPeer::REGION,
            StaffPeer::ORGANIZATION,
            LanguagePeer::NAME,
            StaffPeer::USERNAME,
            StaffRolePeer::ROLENAME,
            StaffPeer::INSERT_DATE,
            StaffPeer::MODIFIED_DATE
        );
    }
}
?>